<link type="text/css" rel="stylesheet" href="{:getRootUrl()}Addons/Redbag/_static/css/redbag.css"/>
<!-- 模态框HTML -->
<form class="ajax-form" method="post" data-role="eject" id="openbag">
    <input type="hidden" name="redBagId" value="{$redbag.id}">
    <style>
        .modal-dialog {
            width: 300px;
            height: 445px;
        }

        .modal-header {
            background-color: #C82727;
            height: 60px;
            border-top-left-radius: 1em;
            border-top-right-radius: 1em;
        }

        .modal-title-name {
            color: #ffffff;
        }

        .modal-body {
            background-color: #C82727;
            min-height: 384px;
            border-bottom-right-radius: 1em;
            border-bottom-left-radius: 1em;
        }

        .modal-dialog {
            border-top-left-radius: 2em;
            border-top-right-radius: 2em;
            border-bottom-right-radius: 2em;
            border-bottom-left-radius: 2em;
        }

    </style>

    <div id="openRedBag2">

        <php>if(empty($getRedBag)){</php>
        <if condition="$noRedbag neq 0">
            <div style="text-align: center" id="openRedBag1">
                <a id="openRedBag" url="{:addons_url('RedBag://RedBag/doOpenRedBag')}"><img
                        src="{:getRootUrl()}Addons/RedBag/_static/image/open.png" style="max-height: 100%;"></a>
            </div>
            <else/>
            <div style="text-align: center">
                <a url="{:addons_url('RedBag://RedBag/doOpenRedBag')}"><img
                        src="{:getRootUrl()}Addons/RedBag/_static/image/isopen.png" style="border-radius: 5%"></a>
            </div>

            <div style="text-align: center">
                <h3 style="color: #ffffff">
                    手速慢了，红包已抢完~
                </h3>
            </div>
        </if>


        <php>}else{</php>
        <div style="text-align: center">
            <a url="{:addons_url('RedBag://RedBag/doOpenRedBag')}"><img
                    src="{:getRootUrl()}Addons/RedBag/_static/image/isopen.gif"
                    style="height: 160px;width: 160px;border-radius: 100%"></a>
        </div>

        <div style="text-align: center">
            <h3 style="color: #ffffff">
                恭喜获得：{$getRedBag}{$unit}{$type_title}
            </h3>
        </div>
        <php>}</php>
    </div>
    <div style="text-align: center">
        <h3 style="color: #ffffff">
            {$redbag.content}
        </h3>
    </div>
    <div style="text-align: center">
        <span>
         <a style="color: #E4DE45" id="lockOther">看看别人的手气</a>
        </span>
    </div>
    <div class="col-md-6"
         style="text-align: center;display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
    <span>
        总额：{$redbag.all_money}{$unit}{$type_title}
    </span>
    </div>
    <div class="col-md-6" style="text-align: center">
    <span>
        领取：<span id="redbag_count">{$redbagcount}</span>/{$redbag.num}
    </span>
    </div>
    <div class="getList" style="display: none">
        <volist name="getList" id="vo">
            <div class="clearfix">
        <span class="col-md-3" title="{$vo.user.nickname}"
              style="color: #D9BDBD;padding: 2px;display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
           {$vo.user.nickname}
        </span>
              <span class="col-md-3" title="{$vo.get_bag}{$vo.type_title}"
                    style="color: #D9BDBD;padding: 2px;display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
         {$vo.get_bag}{$unit}{$vo.type_title}
        </span>
             <span class="col-md-3" title="{$vo.create_time|friendlyDate}"
                    style="color: #D9BDBD;padding: 2px;display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
                {$vo.create_time|friendlyDate}
        </span>

            <if condition="$vo['best_luck'] eq 1">
                <span class="col-md-3" style="color: #D9BDBD;padding: 0px">     气贯长虹 </span>
            </if>
            <if condition="$vo['best_luck'] eq 2">
                <span class="col-md-3" style="color: #D9BDBD;padding: 0px">     最佳手速 </span>
            </if>
            <br>
            </div>
        </volist>
    </div>


    <div style="height: 40px;margin-left: 18px;width: 140px ">

    </div>
</form>
<script>
    $(document).ready(function () {
        $('[data-role="submitreport"]').click(function () {
            $('[data-dismiss="modal"]').click();
        });
        $('#lockOther').click(function () {
            $('.getList').show();
        });
        $('#openRedBag').click(function () {
            var data = $("#openbag").serialize();
            var url = $(this).attr('url');
            $.post(url, data, function (msg) {
                if (msg.status == 1) {
                    $('#openRedBag1').fadeOut(1000);
                    var html = ' <div style="text-align: center" id="openRedBag1">' +
                            '<a ><img src="{:getRootUrl()}Addons/RedBag/_static/image/isopen.gif" style="height: 160px;width: 160px;border-radius: 100%"></a>' +
                            '</div>' +

                            '<div style="text-align: center">' +
                            '<h3 style="color: #ffffff">' + '恭喜获得' + msg.getRedBag + msg.type_title + '</h3>' +
                            '</div>';
                    setTimeout(function () {
                        $('#openRedBag2').append(html);
                    }, 1000);
                    $("#redbag_count").html(parseInt($("#redbag_count").html()) + 1);
                    toast.success(msg.info);
                } else {
                    toast.error(msg.info);
                }
            }, 'json')
        });
    });

</script>



